package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.MarketContactsSyncLogMapper;
import com.ruoyi.bizsys.domain.MarketContactsSyncLog;
import com.ruoyi.bizsys.service.IMarketContactsSyncLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 通讯录同步日志Service业务层处理
 *
 * @author african-loan
 * @date 2021-10-28
 */
@Service
public class MarketContactsSyncLogServiceImpl extends ServiceImpl<MarketContactsSyncLogMapper,MarketContactsSyncLog> implements IMarketContactsSyncLogService {

    /**
     * 查询通讯录同步日志
     *
     * @param id 通讯录同步日志ID
     * @return 通讯录同步日志
     */
    @Override
    public MarketContactsSyncLog selectMarketContactsSyncLogById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询通讯录同步日志列表
     *
     * @param marketContactsSyncLog 通讯录同步日志
     * @return 通讯录同步日志
     */
    @Override
    public List<MarketContactsSyncLog> selectMarketContactsSyncLogList(MarketContactsSyncLog marketContactsSyncLog) {
        return this.list(new QueryWrapper<>(marketContactsSyncLog).last("order by id desc"));
    }

    /**
     * 新增通讯录同步日志
     *
     * @param marketContactsSyncLog 通讯录同步日志
     * @return 结果
     */
            @Override
    public int insertMarketContactsSyncLog(MarketContactsSyncLog marketContactsSyncLog) {
                                                                                                                                                                                                                        marketContactsSyncLog.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(marketContactsSyncLog);
    }

    /**
     * 修改通讯录同步日志
     *
     * @param marketContactsSyncLog 通讯录同步日志
     * @return 结果
     */
            @Override
    public int updateMarketContactsSyncLog(MarketContactsSyncLog marketContactsSyncLog) {
                                                                                                                                                                                                                                                                marketContactsSyncLog.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(marketContactsSyncLog);
    }

    /**
     * 批量删除通讯录同步日志
     *
     * @param ids 需要删除的通讯录同步日志ID
     * @return 结果
     */
            @Override
    public int deleteMarketContactsSyncLogByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除通讯录同步日志信息
     *
     * @param id 通讯录同步日志ID
     * @return 结果
     */
    @Override
    public int deleteMarketContactsSyncLogById(Long id) {
        return baseMapper.deleteById(id);
    }

}
